package kr.saeildadim.androidexam_saeildamil.chapter9;

import kr.saeildadim.androidexam_saeildamil.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;

public class ChangeMenuEx extends Activity {
	boolean mBeginner = true;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch09_changemenu);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		MenuInflater inflater = getMenuInflater();
		if(mBeginner){
			inflater.inflate(R.menu.ch09_beginner, menu);
		}else{
			inflater.inflate(R.menu.ch09_propessional, menu);
		}
		return true;
	}
	
	public void mOnClick(View v){
		switch(v.getId()){
		case R.id.ch09_beginner_btn :
			mBeginner = true;
			invalidateOptionsMenu();
			break;
		case R.id.ch09_professional_btn :
			mBeginner = false;
			invalidateOptionsMenu();
			break;
		}
	}
}
